public class PosprinterService.MyBinder extends Binder implements IMyBinder
| 构造器和说明 |
|---|
PosprinterService.MyBinder() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
acceptdatafromprinter(UiExecute execute)
开启一条线程来接收打印机发送的数据,并将数据存储在一个size为500的环形队列缓存区
|
void |
checkLinkedState(UiExecute execute)
检测app与打印机的连接状态
|
void |
clearBuffer()
清除环形缓存区的数据
|
void |
connectBtPort(java.lang.String bluetoothID,
UiExecute execute)
连接蓝牙端口
|
void |
connectNetPort(java.lang.String ethernetIP,
int ethernetPort,
UiExecute execute)
连接网络端口
|
void |
connectUsbPort(Context context,
java.lang.String usbPathName,
UiExecute execute)
连接USB端口
|
void |
disconnectCurrentPort(UiExecute execute)
断开当前端口,在不需要连接打印机操作或退出应用时调用此方法,断开连接,释放内存,减轻系统负荷
|
RoundQueue<byte[]> |
readBuffer()
读取环形缓存区的数据
|
void |
write(byte[] data,
UiExecute execute)
处理好的数据发送给打印机
|
void |
writeDataByYouself(UiExecute execute,
ProcessData processData)
可以自己实现ProcessData接口方法,来调用工具类的指令调配方法发送自定义的指令集合,适合在此接口实现耗时的数据处理操作
|
public void connectNetPort(java.lang.String ethernetIP,
int ethernetPort,
UiExecute execute)
IMyBinderconnectNetPort 在接口中 IMyBinderpublic void connectBtPort(java.lang.String bluetoothID,
UiExecute execute)
IMyBinderconnectBtPort 在接口中 IMyBinderpublic void connectUsbPort(Context context,
java.lang.String usbPathName,
UiExecute execute)
IMyBinderconnectUsbPort 在接口中 IMyBinderpublic void disconnectCurrentPort(UiExecute execute)
IMyBinderdisconnectCurrentPort 在接口中 IMyBinderpublic void writeDataByYouself(UiExecute execute, ProcessData processData)
IMyBinderwriteDataByYouself 在接口中 IMyBinderexecute - execute接口的实现类,实现方法在UI线程中执行public void acceptdatafromprinter(UiExecute execute)
IMyBinderacceptdatafromprinter 在接口中 IMyBinderpublic RoundQueue<byte[]> readBuffer()
IMyBinderreadBuffer 在接口中 IMyBinderpublic void clearBuffer()
IMyBinderclearBuffer 在接口中 IMyBinderpublic void checkLinkedState(UiExecute execute)
IMyBindercheckLinkedState 在接口中 IMyBinder